#ifndef __RESOURCE_H__
#define __RESOURCE_H__

#include "../../Header/Header.h"
#include "../Shader.h"

class Resource
{
protected:
	GLuint m_iUser;
	bool m_bIsLoaded;
	bool m_bisKilledAfterUnUse;
protected:
	//Generate array buffer
	//Binding vertices data and indices data into vRam
	virtual void Load() = 0;
public:
	Resource(bool bIsKilledAfterUnUse = true) :m_iUser(0), m_bIsLoaded(false), m_bisKilledAfterUnUse(bIsKilledAfterUnUse){}
	virtual ~Resource(){};
	//Binding to data buffer
	virtual void Render(const Shader* sha) = 0;

	//release
	virtual void Unrender() = 0;

	//Increase user count when it has reference
	virtual Resource* Reference() = 0;

	//Decrease user count when it has dereference
	//if user count down to 0,
	//this method will delete buffer data
	//and set loadins flag = false
	//if isKilledAfterUnUse = false all data will release.
	virtual void Dereference() = 0;
};

#endif